package swistak.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

@Entity
@NamedQueries(value = { 
		@NamedQuery(name = Client.NQ_FIND_ALL, query = "select c from Client c order by c.name"),
		@NamedQuery(name = Client.NQ_DELETE_ALL, query = "delete from Client c")
})
public class Client {

	private Long id;
	private String name;
	private String city;
	private String address;
	private String code;
	private String nip;

	public static final String NQ_FIND_ALL = "Client.findAll";
	public static final String NQ_DELETE_ALL = "Client.deleteAll";

	public void setId(Long id) {
		this.id = id;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCity() {
		return city;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getAddress() {
		return address;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getCode() {
		return code;
	}

	public void setNip(String nip) {
		this.nip = nip;
	}

	public String getNip() {
		return nip;
	}

	@Override
	public String toString() {
		return String
				.format("Client [id=%s, name=%s, city=%s, address=%s, code=%s, nip=%s]",
						id, name, city, address, code, nip);
	}

}
